#ifndef __SERVER_CALLBACK_DATA__
#define __SERVER_CALLBACK_DATA__

struct PacketHandlerParamData
{
	UInt32 nSocketIdData;
	PacketDecoder* pDecoder;
};

class ServerCallbackData : public ISocketServerCallback,public PacketDispatcher,public singleton<ServerCallbackData>
{
public:
	ServerCallbackData();
	ServerCallbackData(ISocketServer *pSocketServer);
	virtual ~ServerCallbackData();
	virtual void OnRun();
	virtual void OnRecvData(UInt32 nSocketId, const void* pData, size_t nDataLen);
	//virtual void OnRecvData(unsigned Int32 nSocketId,const void* pData,size_t nDataLen,unsigned short nCmdGroup,unsigned short nCmd);
	virtual void OnNewConnection(UInt32 nSocketId,const std::string& strIp);
	virtual void OnCloseConnection(UInt32 nSocketId,const std::string& strIp);
	virtual void OnStop();
	virtual void OnUpdate();
	virtual void Ping(UInt32 nSocketId);

	ISocketServer * GetSocketServer(){ return m_pSocketServer;};
	void SetSocketServer(ISocketServer* p){ m_pSocketServer = p;};
	void SendPacket(UInt32 nSocketId,PacketEncoder& encoder);

	void phPing_0(void *pVoid);
private:
	ISocketServer *m_pSocketServer;
};

void SendPacket(UInt32 nSocketId,PacketEncoder& encoder);
#endif


